<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>推送列表页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
    <meta name="author" content="Muhammad Usman">

    <!-- The styles -->
    <link id="bs-css" href="/posterwebchat/Public/charisma-master/css/bootstrap-cerulean.min.css" rel="stylesheet">

    <link href="/posterwebchat/Public/charisma-master/css/charisma-app.css" rel="stylesheet">
    <link href='/posterwebchat/Public/charisma-master/bower_components/fullcalendar/dist/fullcalendar.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/bower_components/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print'>
    <link href='/posterwebchat/Public/charisma-master/bower_components/chosen/chosen.min.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/bower_components/colorbox/example3/colorbox.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/bower_components/responsive-tables/responsive-tables.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css' rel='stylesheet'>

    <link href='/posterwebchat/Public/charisma-master/css/jquery.noty.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/css/noty_theme_default.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/css/elfinder.min.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/css/elfinder.theme.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/css/jquery.iphone.toggle.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/css/uploadify.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/charisma-master/css/animate.min.css' rel='stylesheet'>
    <link href='/posterwebchat/Public/css/common.css' rel='stylesheet'>

    <!-- jQuery -->
    <script src="/posterwebchat/Public/charisma-master/bower_components/jquery/jquery.min.js"></script>

    <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- The fav icon -->
    <link rel="shortcut icon" href="img/favicon.ico">
</head>
<body>
<!-- topbar starts -->
<div class="navbar navbar-default" role="navigation">

    <div class="navbar-inner">
        <button type="button" class="navbar-toggle pull-left animated flip">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="index.html"> <img alt="Charisma Logo" src="/sae/Public/charisma-master/img/logo20.png" class="hidden-xs"/>
            <span>Charisma</span></a>

        <!-- user dropdown starts -->
        <div class="btn-group pull-right">
            <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                <i class="glyphicon glyphicon-user"></i><span class="hidden-sm hidden-xs"><?php echo (session('userName')); ?></span>
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu">
                <li><a href="#">Profile</a></li>
                <li class="divider"></li>
                <li><a href="<?php echo U('logout');?>">Logout</a></li>
            </ul>
        </div>
        <!-- user dropdown ends -->

        <!-- theme selector starts -->
        <div class="btn-group pull-right theme-container animated tada">
            <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                <i class="glyphicon glyphicon-tint"></i><span
                    class="hidden-sm hidden-xs"> Change Theme / Skin</span>
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" id="themes">
                <li><a data-value="classic" href="#"><i class="whitespace"></i> Classic</a></li>
                <li><a data-value="cerulean" href="#"><i class="whitespace"></i> Cerulean</a></li>
                <li><a data-value="cyborg" href="#"><i class="whitespace"></i> Cyborg</a></li>
                <li><a data-value="simplex" href="#"><i class="whitespace"></i> Simplex</a></li>
                <li><a data-value="darkly" href="#"><i class="whitespace"></i> Darkly</a></li>
                <li><a data-value="lumen" href="#"><i class="whitespace"></i> Lumen</a></li>
                <li><a data-value="slate" href="#"><i class="whitespace"></i> Slate</a></li>
                <li><a data-value="spacelab" href="#"><i class="whitespace"></i> Spacelab</a></li>
                <li><a data-value="united" href="#"><i class="whitespace"></i> United</a></li>
            </ul>
        </div>
        <!-- theme selector ends -->

        <ul class="collapse navbar-collapse nav navbar-nav top-menu">
            <li><a href="#"><i class="glyphicon glyphicon-globe"></i> Visit Site</a></li>
            <li class="dropdown">
                <a href="#" data-toggle="dropdown"><i class="glyphicon glyphicon-star"></i> Dropdown <span
                        class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Separated link</a></li>
                    <li class="divider"></li>
                    <li><a href="#">One more separated link</a></li>
                </ul>
            </li>
            <li>
                <form class="navbar-search pull-left">
                    <input placeholder="Search" class="search-query form-control col-md-10" name="query"
                           type="text">
                </form>
            </li>
        </ul>
    </div>
</div>
<!-- topbar ends -->
    <!-- topbar ends -->
<div class="ch-container">
    <div class="row">
        <!-- left menu starts -->
        <div class="col-sm-2 col-lg-2">
            <div class="sidebar-nav">
                <div class="nav-canvas">
                    <div class="nav-sm nav nav-stacked">

                    </div>
                    <ul class="nav nav-pills nav-stacked main-menu">
                        <li class="nav-header">功能</li>
                        <li><a class="ajax-link" href="<?php echo U('poster');?>"><i class="glyphicon glyphicon-home"></i><span> 主页</span></a>
                        </li>
                        <li><a class="ajax-link" href="<?php echo U('posterList');?>"><i
                                class="glyphicon glyphicon-align-justify"></i><span> 推送列表</span></a></li>
                        <li><a class="ajax-link" href="<?php echo U('newPoster');?>"> <i
                                class="glyphicon glyphicon-plus-sign"></i><span> 新增推送</span></a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <!--/span-->
        <!-- left menu ends -->

        <noscript>
            <div class="alert alert-block col-md-12">
                <h4 class="alert-heading">Warning!</h4>

                <p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
                    enabled to use this site.</p>
            </div>
        </noscript>

        <div id="content" class="col-lg-10 col-sm-10">
            <!-- content starts -->
            <div>
    <ul class="breadcrumb">
        <li>
            <a href="#">Home</a>
        </li>
        <li>
            <a href="#">Forms</a>
        </li>
    </ul>
</div>

<div class="row">
    <div class="box col-md-12">
        <div class="box-inner">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-edit"></i>推送详情预览</h2>
            </div>
            <div class="box-content">
                <div class="alert alert-info">推送详细信息</div>
                <br>
                <div class="form-group has-success col-md-4">
                    <label class="control-label" for="post_title">推送标题</label>
                    <input type="hidden" name="post_id" id="post_id" value="<?php echo ($data["post_id"]); ?>">
                    <input type="text" class="form-control" name="post_title" id="post_title" value="<?php echo ($data["post_title"]); ?>">
                </div>
                <div class="clearfix"></div>
                <div class="form-group has-success col-md-4">
                    <label class="control-label" for="status">推送状态</label>
                    <input data-no-uniform="true" name="status" id="status" type="checkbox" <?php if(isset($data) == true and $data["status"] == 1): ?>checked="checked" <?php else: endif; ?> class="iphone-toggle" >
                </div>
                <div class="clearfix"></div>
                <div class="form-group has-success col-md-4">
                    <label class="control-label" for="">推送信息 <strong>(<a href="http://www.ipaiban.com/">微信编辑器</a>的排版代码)</strong></label>
                    <br/>
                    <textarea name="post_content" id="post_content"  style="width:1000px;height:300px;"><?php echo ($data["post_content"]); ?></textarea>
                </div>
                <div class="clearfix"></div>
                <div class="form-group has-success col-md-4">
                    <button class="btn btn-primary btn-lg" id="isOk">确定</button>
                    <button class="btn btn-primary btn-lg" id="pre" onclick="window.history.back();">返回</button>
                </div>
                <div class="clearfix"></div>
                <button class="btn btn-primary noty" style="display:none"
                        data-noty-options="{&quot;text&quot;:&quot;标题和内容不能为空&quot;,&quot;layout&quot;:&quot;top&quot;,&quot;type&quot;:&quot;error&quot;}">
                    <i class="glyphicon glyphicon-bell icon-white"></i> Top Right
                </button>
            </div>
        </div>
    </div>
    <!--/span-->

</div><!--/row-->


    <!-- content ends -->
    </div><!--/#content.col-md-0-->
</div><!--/fluid-row-->

<footer class="row">
    <p class="col-md-9 col-sm-9 col-xs-12 copyright">&copy; <a href="http://usman.it" target="_blank">Muhammad
        Usman</a> 2012 - 2015</p>

    <p class="col-md-3 col-sm-3 col-xs-12 powered-by">Powered by: <a
            href="http://usman.it/free-responsive-admin-template">Charisma</a></p>
</footer>

</div><!--/.fluid-container-->

<!-- external javascript -->

<script src="/posterwebchat/Public/charisma-master/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

<!-- library for cookie management -->
<script src="/posterwebchat/Public/charisma-master/js/jquery.cookie.js"></script>
<!-- calender plugin -->
<script src='/posterwebchat/Public/charisma-master/bower_components/moment/min/moment.min.js'></script>
<script src='/posterwebchat/Public/charisma-master/bower_components/fullcalendar/dist/fullcalendar.min.js'></script>
<!-- data table plugin -->
<script src='/posterwebchat/Public/charisma-master/js/jquery.dataTables.min.js'></script>

<!-- select or dropdown enhancer -->
<script src="/posterwebchat/Public/charisma-master/bower_components/chosen/chosen.jquery.min.js"></script>
<!-- plugin for gallery image view -->
<script src="/posterwebchat/Public/charisma-master/bower_components/colorbox/jquery.colorbox-min.js"></script>
<!-- notification plugin -->
<script src="/posterwebchat/Public/charisma-master/js/jquery.noty.js"></script>
<!-- library for making tables responsive -->
<script src="/posterwebchat/Public/charisma-master/bower_components/responsive-tables/responsive-tables.js"></script>
<!-- tour plugin -->
<script src="/posterwebchat/Public/charisma-master/bower_components/bootstrap-tour/build/js/bootstrap-tour.min.js"></script>
<!-- star rating plugin -->
<script src="/posterwebchat/Public/charisma-master/js/jquery.raty.min.js"></script>
<!-- for iOS style toggle switch -->
<script src="/posterwebchat/Public/charisma-master/js/jquery.iphone.toggle.js"></script>
<!-- autogrowing textarea plugin -->
<script src="/posterwebchat/Public/charisma-master/js/jquery.autogrow-textarea.js"></script>
<!-- multiple file upload plugin -->
<script src="/posterwebchat/Public/charisma-master/js/jquery.uploadify-3.1.min.js"></script>
<!-- history.js for cross-browser state change on ajax -->
<script src="/posterwebchat/Public/charisma-master/js/jquery.history.js"></script>
<!-- application script for Charisma demo -->
<script src="/posterwebchat/Public/charisma-master/js/charisma.js"></script>
<script src="/posterwebchat/Public/charisma-master/js/jquery.IvanDialog.js"></script>
</body>
</html>

<script charset="utf-8" src="/posterwebchat/Public/kindeditor-4.1.10/kindeditor-min.js"></script>
<script charset="utf-8" src="/posterwebchat/Public/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script>

    /*预览*/
    $("#perview").on("click",function(){
        location.href="<?php echo U('posterPreview');?>";
    });
    KindEditor.ready(function(K) {
        var options = {
            filterMode : false,
            allowFileManager : true
        };
        var editor = K.create('#post_content', options);

        /*确定*/
        $("#isOk").on("click",function(){
            if(!$('#post_content').val() || !$("#post_title").val()){
                $(".noty").click();
                return false;
            }
            var params ={"post_id":$("#post_id").val(),"post_content":editor.html(),"post_title":$("#post_title").val(),"status":$("#status").val()=='on'?1:0};
            $.ajax({ url:"<?php echo U('posterPersist');?>" , data: params, type: "post", dataType: "json", cache: false, async: true,
                success: function(data){
                    if(!!data && data.status){
                        $.IvanDialogOpen({
                            Type: 'tips',
                            Info: "推送添加成功",
                            Plugins: { CloseTime: 1200 }
                        });
                    }else{
                        $.IvanDialogOpen({
                            Type: 'tips',
                            Info: "推送添加失败",
                            Plugins: { CloseTime: 1200 }
                        });
                    }
                },
                error: function (XMLresponseText){
                    alert(XMLresponseText);
                }
            });
        });

    });
</script>